package view.swing.popup;

import java.awt.Component;

import javax.swing.JOptionPane;

import model.Letter;
import util.Coordinate;
import util.Resources;
public class JokerValue {

	public Coordinate coord;
	private Component parentWindow;

	public JokerValue(Component parentWindow, Coordinate coord) {
		this.coord = coord;
		this.parentWindow = parentWindow;
	}

	public Letter askValue() {
		Letter[] choixPossibles = new Letter[Letter.values().length - 1];
		int i = 0;
		while (i < Letter.values().length - 1) {
			if (Letter.values()[i] != Letter.BLANK) {
				choixPossibles[i] = Letter.values()[i++];
			}
		}
		return (Letter) JOptionPane.showInputDialog(parentWindow,
				Resources.getString("Joker.Dropped", coord)
						+ "\n"+Resources.getString("Joker.WhatLetter"),
						Resources.getString("Joker.Value"), JOptionPane.QUESTION_MESSAGE, null,
				choixPossibles, null);
	}
}
